package com.lixin.smartclassroom.ui.home.tab5.activity

import com.drake.brv.utils.bindingAdapter
import com.drake.net.utils.scopeNetLife
import com.lixin.smartclassroom.api.liulanlist
import com.lixin.smartclassroom.bean.DataListBean
import com.lixin.smartclassroom.databinding.FragmentRecyclerCustomBinding
import com.lixin.smartclassroom.ui.home.adapter.abnormalTotal
import com.lixin.smartclassroom.ui.home.adapter.messageBoardHistory
import com.lixinkeji.base.BaseActivity
import com.lixinkeji.extension.gone
import com.lixinkeji.extension.start
import com.lixinkeji.extension.visible

/**
 * Description 历史留言
 * Author: lwc
 * Date:2023/12/9 9:29
 */
class MessageBoardHistoryAct : BaseActivity<FragmentRecyclerCustomBinding>() {
    override fun getViewBinding() = FragmentRecyclerCustomBinding.inflate(layoutInflater)

    override fun topBarHide() = false
    override fun startPadding() = true
    private lateinit var listBean: ArrayList<DataListBean>
    override fun title() = "历史留言"
    override fun textMenuContent() = "发表留言"

    override fun onTextMenuListener() {
        start(MessageBoardAct::class.java)
    }


    override fun iniView() {

        binding.recycler.messageBoardHistory()

        binding.apply {
            refresh.onRefresh {
                scopeNetLife {
                    listBean = liulanlist(index, 10)!!
                    addData(listBean) {
                        if (binding.recycler.bindingAdapter.models?.size == 0) {
                            binding.state.showEmpty()
                            binding.recycler.gone()
                        } else {
                            binding.recycler.visible()
                        }
                        listBean.size == 10
                    }
                }
            }.autoRefresh()
        }
    }
}